package com.party.core.service.mall;

import com.party.common.paging.Page;
import com.party.core.model.mall.MallOrderDetail;
import com.party.core.model.mall.MallOrderOutputParent;
import com.party.core.model.mall.MallOrderOutputPay;
import com.party.core.model.mall.MallOrderWithLogisticsOutput;
import com.party.core.service.IBaseService;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Author: Administrator.
 * @Description: 商城订单详情
 * @Date:Created in 2017/8/30 0030 上午 9:49.
 */
public interface IMallOrderDetailService extends IBaseService<MallOrderDetail> {

    /**
     * 根据订单id获取订单及子订单
     *
     * @param orderId 订单id
     * @return
     */
    MallOrderOutputPay findByOrderId(String orderId);

    /**
     * 根据支付订单id获取订单及子订单
     *
     * @param orderId       支付订单id
     * @param distributorId 分销者id
     * @return
     */
    MallOrderOutputPay findByOrderId(String orderId, String distributorId);

    /**
     * 获取销量
     *
     * @param productId  产品id
     * @param productIds 产品IDS
     * @return
     */
    Long getSalesNum(String productId, List<String> productIds);

    /**
     * 获取有效的订单
     *
     * @param productId
     * @return
     */
    Long getSuccessNum(String productId);

    /**
     * 待支付的订单
     *
     * @param productId 产品id
     * @param goodsId   商品id
     * @return
     */
    Long getNotPay(String productId, String goodsId);

    /**
     * 待支付的订单
     *
     * @param goodsId    商品id
     * @param productIds 产品IDS
     * @return
     */
    Long getNotPay(String goodsId, List<String> productIds);

    /**
     * 获取没有退款的订单数
     *
     * @param parentId 主订单id
     * @param status   退款成功状态
     * @param orderId  支付订单id
     * @return
     */
    Long getNotRefund(String parentId, Integer status, String orderId);

    List<MallOrderDetail> findByProductId(String productId);

    /**
     * 获取子订单及物流信息
     *
     * @param orderId 支付订单id
     * @param status  状态
     * @return
     */
    List<MallOrderOutputParent> listWithLogistics(String orderId, Set<Integer> status);

    /**
     * 获取已发货的商品及物流信息
     *
     * @param parentId 主订单id
     * @return
     */
    List<MallOrderWithLogisticsOutput> listWithShipment(String parentId);

    /**
     * 获取待发货的商品
     *
     * @param orderId 支付订单id
     * @return
     */
    List<MallOrderOutputParent> listWithNotShipment(String orderId);

    List<MallOrderOutputPay> webListPage(MallOrderDetail orderDetail, Map<String, Object> params, Page page);

    /**
     * 筛选支付订单
     *
     * @param orderDetail
     * @param params
     * @param page
     * @return
     */
    List<MallOrderOutputPay> payOrderList(MallOrderDetail orderDetail, Map<String, Object> params, Page page);

    MallOrderDetail getUniqueByOrderId(String orderId);

    List<MallOrderDetail> findParentByOrderId(String orderId);

    /**
     * 我的分销订单
     *
     * @param orderDetail
     * @param params
     * @param page
     * @return
     */
    List<MallOrderOutputPay> getDistributorOrderList(MallOrderDetail orderDetail, Map<String, Object> params, Page page);

    /**
     * 我的收入数据
     *
     * @param params 请求参数
     * @return
     */
    List<Map<String, Object>> getRevenueData(Map<String, Object> params);

    Map<String, Object> findDataCountByDistributor(String distributorId, Date createDate);

    Set<Integer> findStatusByOrderId(String orderId);

    Map<String, Object> countAnalyzeByDate(String startDate, String endDate);

    /**
     * 获取已结算金额
     *
     * @param memberId 用户id
     * @return 金额
     */
    Double getSumTotal(String memberId);
}
